
Version:=0.93
ModuleName:=clamav

Objcet:=$(ModuleName).run.tgz
Objcet_Cvd:=$(ModuleName).cvd.tgz
ObjectDir:=$(ModuleName)-$(Version)
ObjcetSource:=$(ModuleName)-$(Version).tar.gz

DependFiles:=
InstaLibDir:=usr/local/lib

InstallDirTmp:=usr/local/$(ModuleName)
InstallDir:=/$(InstallDirTmp)
ManDir:=/tmp

Config:=--mandir=$(ManDir) --prefix=$(InstallDir) #--without-libcurl

.PHONY: all clean dist_clean

all:$(Objcet) $(Objcet_Cvd)

$(Objcet):$(ObjcetSource) clamd.conf freshclam.conf
	tar -xzf $(ObjcetSource)
	cd $(ObjectDir);./configure $(Config)
	$(MAKE) -C $(ObjectDir)
	$(MAKE) -C $(ObjectDir) install # Install to system for php config.
	$(MAKE) -C $(ObjectDir) install DESTDIR=`pwd`/
	mkdir -p $(InstaLibDir)
	cp -af $(InstallDir)/lib/libclamav.so.4* $(InstaLibDir)
	cp -af /usr/lib/libgmp.so* /lib/libbz2.so* $(InstaLibDir)
	cp -arf usr/local/clamav/lib/* $(InstaLibDir)
	cp clamd.conf $(InstallDirTmp)/etc/ -rf
	cp freshclam.conf $(InstallDirTmp)/etc/ -rf
	tar -czf $(Objcet) $(InstallDirTmp)/bin $(InstallDirTmp)/sbin $(InstallDirTmp)/etc/ $(InstaLibDir)
$(Objcet_Cvd):
	tar -czf $(Objcet_Cvd) $(InstallDirTmp)/share

clean:
	rm -rf $(Objcet) usr $(Objcet_Cvd)

dist_clean:clean
	rm -rf $(ObjectDir) $(ObjcetSource) tmp *.tar.gz
	
include ../Makefile.Res
